package cn.sc.summer.protocol.form.route;

import cn.sc.summer.protocol.ValidatedGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 类名：新增路由请求表单
 *
 * @author a-xin
 * @date 2023/12/4 11:15
 */
@Data
@Accessors(chain = true)
@ApiModel("新增路由请求表单")
public class RouteForm implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 数据ID
     */
    @ApiModelProperty(value = "数据ID")
    @NotBlank(message = "ID不能为空！", groups = ValidatedGroup.UPDATE_ROUTE.class)
    private String id;

    /**
     * 菜单编码
     */
    @ApiModelProperty(value = "菜单编码")
    @NotBlank(message = "菜单编码不能为空！", groups = {ValidatedGroup.UPDATE_ROUTE.class, ValidatedGroup.ADD_ROUTE.class})
    private String code;

    /**
     * 菜单路由地址
     */
    @ApiModelProperty(value = "菜单路由地址")
    @NotBlank(message = "菜单路由地址不能为空！", groups = {ValidatedGroup.UPDATE_ROUTE.class, ValidatedGroup.ADD_ROUTE.class})
    private String route;

    /**
     * 是否开启
     */
    @ApiModelProperty(value = "是否开启")
    @NotNull(message = "开启状态不能为空！", groups = {ValidatedGroup.UPDATE_ROUTE.class, ValidatedGroup.ADD_ROUTE.class})
    @Min(value = 0, message = "开启状态不正确！")
    @Max(value = 1, message = "开启状态不正确！")
    private Integer open;

    /**
     * 父级ID
     */
    @ApiModelProperty(value = "父级ID")
    @NotBlank(message = "父级ID不能为空！", groups = ValidatedGroup.ADD_ROUTE.class)
    private String pId;

    /**
     * 优先级别
     */
    @ApiModelProperty(value = "优先级别")
    @NotNull(message = "优先级别不能为空！", groups = {ValidatedGroup.UPDATE_ROUTE.class, ValidatedGroup.ADD_ROUTE.class})
    private Integer priority;

    /**
     * 路由名称
     */
    @ApiModelProperty(value = "部门名称")
    @NotBlank(message = "部门名称不能为空！", groups = {ValidatedGroup.UPDATE_ROUTE.class, ValidatedGroup.ADD_ROUTE.class})
    private String name;

}
